<%-- 
    Document   : c_if
    Created on : 2012-12-10, 21:18:09
    Author     : Administrator
--%>

<%@page contentType="text/html" import="com.hsp.domain.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" F
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
    </head>
    <body>

        <h1>c:if的使用</h1>
        <% request.setAttribute("a", "hello");
            request.setAttribute("age", "55");

            //放入一个老鼠对象 
            Rat rat = new Rat();
            rat.setName("小宝");
            rat.setAge(10);
            request.setAttribute("rat1", rat);
        %>

        <c:if test= "${a == 'hello'}">
            ok!
        </c:if>

        <c:if test= "${a !='hello'}">no ok</c:if>

        <h1>判断数值</h1>
        <c:if test = "${age ==56 }">
            等于56
        </c:if>

        <c:if test = "${age <56 }">
            小于56
        </c:if>
        <br>
            <c:if test= "${ age > 10 and age < 60}">age > 10 and age < 60 </c:if>

            <br>

                <h1>判断对象的属性</h1>
                <c:if test = "${rat1.age > 3}">小老鼠年龄大于3岁</c:if>
                </body>
                </html>
